import Vue from 'vue'
import Router from 'vue-router'
import Test from '@/views/test'
import Login from '@/components/Login'
import Content from '@/components/Content'
import Home from '@/views/home/home'
import ResourceGroup from '@/views/home/resourceGroup'
import Dashboard from '@/views/dashboard/home'
Vue.use(Router)

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default new Router({
  mode: 'history',
  // mode: 'hash',
  routes: [
    {
      path: '/',
      name: 'Login',
      component: Login
    },
    {
      path: '/test',
      name: 'Test',
      component: Test
    },
    {
      path: '/resourceGroup',
      name: 'ResourceGroup',
      component: ResourceGroup
    },
    {
      path: '/Content',
      name: 'Content',
      component: Content,
      children: [
        {
          path: '/home',
          name: 'Home',
          component: Home
        },
        {
          path: '/dashboard',
          name: 'Dashboard',
          component: Dashboard
        }
      ]
    }
  ]
})
